import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalDate;
import java.time.format.DateTimeParseException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String d1=sc.next();
        try {
            LocalDate date = LocalDate.parse(d1);
            int y1 = date.getDayOfYear();
            int m1 = date.getDayOfMonth();
            DayOfWeek w1 = date.getDayOfWeek();
            Map<DayOfWeek, Integer> map = new HashMap<DayOfWeek, Integer>();
            map.put(DayOfWeek.MONDAY, 1);
            map.put(DayOfWeek.TUESDAY, 2);
            map.put(DayOfWeek.WEDNESDAY, 3);
            map.put(DayOfWeek.THURSDAY, 4);
            map.put(DayOfWeek.FRIDAY, 5);
            map.put(DayOfWeek.SATURDAY, 6);
            map.put(DayOfWeek.SUNDAY, 7);
            String j = "不是";
            if (date.isLeapYear())
                j = "是";
            System.out.println(d1 + j + "闰年。");
            System.out.println(d1 + "是当年第" + y1 + "天，当月第" + m1 + "天，当周第" + map.get(w1) + "天。");
        }
        catch (DateTimeParseException e)
        {
            System.out.println(d1+"无效！");
        }
    }
}